package com.crr.config;

import feign.Logger;
import feign.Retryer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FeignConfig {
    /**
     * openFeign重试机制
     *
     * @return
     */
    @Bean
    public Retryer myRetryer() {
         return Retryer.NEVER_RETRY;//feign默认配置不走重试策略
        //最大请求次数为3（1+2）一次默认2次重试。初始间隔时间为100ms ，重试最大间隔时间为1s
        //return new Retryer.Default(100, 1, 3);
    }

    /**
     * 开启feign日志
     *
     * @return
     */
    @Bean
    public Logger.Level feignLoggerLevel() {
        return feign.Logger.Level.HEADERS;
    }
}
